<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%-- <%@taglib uri="spring.tld" prefix="spring"%> --%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String servletPath = (String)request.getAttribute("javax.servlet.forward.servlet_path");
String[] list = servletPath.split("\\/");
request.setAttribute("role",list[1]);
request.setAttribute("topMenuId",list[2]);
request.setAttribute("leftMenuId",list[3]);
%>

<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>试题统计</title>
		<meta name="keywords" content="">
		<link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico" />
		<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">
		<link href="resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="resources/css/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
		<link href="resources/css/style.css" rel="stylesheet">
		
		<link href="resources/css/exam.css" rel="stylesheet">
		<link href="resources/chart/morris.css" rel="stylesheet">
		<style>
			.change-property, .publish-paper, .delete-paper, .offline-paper{
				cursor:pointer;
			}
		</style>
	</head>
	<body>
		<header>
			<span style="display:none;" id="rule-role-val"><%=list[1]%></span>
			<div class="container">
				<div class="row">
					<div class="col-xs-5">
						<%@ include file="common/header.jsp"%>
					</div>
					<div class="col-xs-7" id="login-info">
						<c:choose>
							<c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">
								<div id="login-info-user">
									
									<a href="user-detail/${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}" id="system-info-account" target="_blank">${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}</a>
									<span>|</span>
									<a href="j_spring_security_logout"><i class="fa fa-sign-out"></i> 退出</a>
								</div>
							</c:when>
							<c:otherwise>
								<a class="btn btn-primary" href="user-register">用户注册</a>
								<a class="btn btn-success" href="user-login-page">登录</a>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
			</div>
		</header>
		<!-- Navigation bar starts -->

		<div class="navbar bs-docs-nav" role="banner">
			<div class="container">
				<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
					<c:import url="/common-page/top-menu?topMenuId=${topMenuId}&leftMenuId=${leftMenuId}" charEncoding="UTF-8" />
				</nav>
			</div>
		</div>

		<!-- Navigation bar ends -->

		<!-- Slider starts -->

		<div>
			<!-- Slider (Flex Slider) -->

			<div class="container" style="min-height:500px;">

				<div class="row">
					<div class="col-xs-2" id="left-menu">
						<c:import url="/common-page/left-menu?topMenuId=${topMenuId}&leftMenuId=${leftMenuId}" charEncoding="UTF-8" />
					</div>
					<div class="col-xs-10" id="right-content">
						<div class="page-header">
							<h1><i class="fa fa-list-ul"></i> 试题统计 </h1>
						</div>
						<div>
							<div id="question-filter">
								<dl id="question-filter-createTime">
									<dt>
										统计时间：
									</dt>
									<dd>
										<input id="question-start-date" type="text" class="df-input-narrow" style="width: 16%;" value="${createStart}">
										至
										<input id="question-stop-date" type="text" class="df-input-narrow" style="width: 16%;" value="${createStop}">
									</dd>
								</dl>
								<dl id="question-filter-status">
									<input type="hidden" value="${status}" id="questionStatus"/>
									<dt>
										试题状态：
									</dt>
									<dd>
										<c:choose>
											<c:when test="${status == 0 }">
												<span data-id="0" class="label label-info">全部</span>
											</c:when>
											<c:otherwise>
												<span data-id="0">全部</span>
											</c:otherwise>
										</c:choose>
										<c:forEach items="${statusList}" var="tmp">
											<c:choose>
												<c:when test="${status == tmp.statusId }">
													<span data-id="${tmp.statusId}" class="label label-info">${tmp.statusName}</span>
												</c:when>
												<c:otherwise>
													<span data-id="${tmp.statusId}">${tmp.statusName}</span>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</dd>
								</dl>
								<div class="page-link-content" style="float:right;margin-left:30px;">
									<ul class="pagination pagination-sm">${pageStr}</ul>
								</div>
							</div>
							<div class="table-search table-controller-item"
							style="float: left;width: 300px;padding: 10px 0px;">
								<div class="input-group search-form">
									<input type="text" class="form-control" placeholder="搜索用户" value="${searchStr }"
									id="txt-search">
									<span class="input-group-btn">
										<button class="btn btn-sm btn-default" type="button"
										id="btn-search" >
											<i class="fa fa-search"></i>搜索
										</button> </span>
								</div>
							</div>
							<div id="question-list">
								<table class="table-striped table">
									<thead>
										<tr>
											<td>ID</td><td>用户名称</td><td>真实姓名</td><td>邮箱</td><td>手机号码</td><td>部门</td><td>上次登录时间</td><td>状态</td><td>试题数目</td>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${questionUserList }" var="item">
											<tr>
												<td>${item.userId }</td>
												<td>${item.userName }</td>
												<td>${item.trueName }</td>
												<td>${item.email }</td>
												<td>${item.phoneNum }</td>
												<td>${item.department }</td>
												<td><fmt:formatDate value="${item.lastLoginTime}" pattern="yyyy-MM-dd HH:mm"/></td>
												<td>
													<c:choose>
														<c:when test="${item.enabled == true }">
															已启用
														</c:when>
														<c:otherwise>
															已禁用
														</c:otherwise>
													</c:choose>
												</td>

												<td style="color:red;">${item.questionNum }</td>
											</tr>
										</c:forEach>
										
									</tbody><tfoot></tfoot>
								</table>

							</div>
							<div class="page-link-content">
									<ul class="pagination pagination-sm">${pageStr}</ul>
								</div>

						</div>
					</div>
				</div>
			</div>
		</div>

		<footer>

			<%@ include file="common/footer.jsp"%>

		</footer>

		<!-- Slider Ends -->

		<!-- Javascript files -->
		<!-- jQuery -->
		<script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
		<script type="text/javascript" src="resources/js/all.js"></script>
		<!-- Bootstrap JS -->
		<script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="resources/js/question-count.js?v=1"></script>

		<script type="text/javascript" src="resources/js/jquery.ui.datepicker-zh-TW.js"></script>
		<script type="text/javascript" src="resources/js/jquery/jquery-ui-1.9.2.custom.min.js"></script>

		<script type="text/javascript">
            $(function() {
                $("#question-start-date, #question-stop-date").datepicker({
                    changeYear: true,
					showButtonPanel: true,
                    dateFormat: "yy-mm-dd"
				}).attr("readonly","readonly");
            });

		</script>

	</body>
</html>